<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<body>
    <!-- 导航栏片段 -->
    <nav th:fragment="navbar" class="navbar navbar-expand-lg navbar-dark mb-4">
        <div class="container">
            <a class="navbar-brand" href="/">OKX 数据展示</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" th:classappend="${#httpServletRequest.requestURI == '/' ? 'active' : ''}" href="/">首页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:classappend="${#httpServletRequest.requestURI.startsWith('/positions') ? 'active' : ''}" href="/positions">持仓信息</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:classappend="${#httpServletRequest.requestURI.startsWith('/ticker') ? 'active' : ''}" href="/ticker">行情信息</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:classappend="${#httpServletRequest.requestURI.startsWith('/all-markets') ? 'active' : ''}" href="/all-markets">所有行情</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:classappend="${#httpServletRequest.requestURI.startsWith('/accounts') ? 'active' : ''}" href="/accounts">产品管理</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:classappend="${#httpServletRequest.requestURI.startsWith('/orders') ? 'active' : ''}" href="/orders">订单记录</a>
                    </li>
                </ul>
                <ul class="navbar-nav ms-auto">
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                            <span sec:authentication="name">用户名</span>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="userDropdown">
                            <li>
                                <form th:action="@{/logout}" method="post" class="dropdown-item">
                                    <button type="submit" class="btn btn-link p-0">退出登录</button>
                                </form>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
</body>
</html> 